﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace SchEdu.Framework.DataModel
{
    public class SolutionList : List<SchEduDataSet.SolutionRow>
    {
        public SolutionList()
            : base()
        {
        }
        public SolutionList(SchEduDataSet.SolutionDataTable solution)
        {
            foreach(SchEduDataSet.SolutionRow s in solution)
            {
                Add(s);
            }
        }

        public void SortByID()
        {
            Sort(new IDComparer());
        }

        class IDComparer : Comparer<SchEduDataSet.SolutionRow>
        {

            public override int Compare(SchEduDataSet.SolutionRow x, SchEduDataSet.SolutionRow y)
            {
                if (x.ID < y.ID)
                {
                    return -1;
                }
                if (x.ID > y.ID)
                {
                    return 1;
                }
                return 0;
            }
        }


    }
}
